<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../back-common.jsp" %>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<script type="text/javascript" src="<ls:templateResource item='/resources/common/js/ajaxfileupload.js'/>"></script>
<script type='text/javascript' src="<ls:templateResource item='/resources/common/js/jquery.validate.js'/>"></script>
<link type="text/css" href="<ls:templateResource item='/resources/templets/goat/css/publishProd1${_style_}.css'/>" rel="stylesheet"/>

<script type="text/javascript">
    $(document).ajaxSend(function (e, xhr, options) {
        var _csrf_header = '${_csrf.headerName}';
        var _csrf = '${_csrf.token}';
        if (_csrf != null && _csrf_header != null) {
            if (xhr.setRequestHeader) {
                xhr.setRequestHeader(_csrf_header, _csrf);
            }
        }
    });
    function appendCsrfInput() {
        var _csrf_header = '${_csrf.parameterName}';
        var _csrf = '${_csrf.token}';
        var hiddenField = document.createElement("input");
        if (_csrf != null && _csrf_header != null) {
            hiddenField.setAttribute("type", "hidden");
            hiddenField.setAttribute("name", _csrf_header);
            hiddenField.setAttribute("value", _csrf);
        }
        return hiddenField;
    }
</script>

<%
    Long offset = (Long) request.getAttribute("offset");
%>

<form:form action="${contextPath}/admin/paytype/query" id="form1" method="post">
    <table class="${tableclass}" style="width: 100%">
        <tr>
            <th><strong class="am-text-primary am-text-lg">系统管理</strong> / 配置测试</th>
        </tr>
        </thead>
    </table>

</form:form>
<div align="center">
    <%@ include file="/WEB-INF/pages/common/messages.jsp" %>
    <display:table name="list" requestURI="/admin/system/config/query" id="item" export="false" class="${tableclass}" style="width:100%" sort="external">
        <display:column title="顺序" class="orderwidth" style="width:50px"><%=offset++%>
        </display:column>
        <display:column style="width:100px;" title="功能说明" property="configItemExplain"></display:column>
        <display:column style="width:100px;" title="参数名称" property="configItemName"></display:column>
        <display:column style="max-width:200px;word-break:break-all;font-weight:bold" title="参数" property="configItemParas"></display:column>
    </display:table>
    <ls:page pageSize="${pageSize }" total="${total}" curPageNO="${curPageNO }" actionUrl="javascript:pager" type="default"/>
</div>


<table class="${tableclass}" id="col1" style="width:100%;padding: 30px;font-weight:bold">
    <tr>
        <td colspan="2">短信测试</td>
    </tr>
    <tr>
        <td>
            <form:form action="${contextPath}/admin/system/config/sendSMSCode" method="post" name="userRegForm" id="userRegForm">
                请输入正确的手机号码：
                <input type="text" class="text" id="tel" maxlength="11" name="tel" placeholder="请输入11位手机号码">
                <button type="submit" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="">短信测试</button>
            </form:form>
        </td>
    </tr>
    <tr>
        <td>
            <span>${sendSMSResult}</span>
        </td>
    </tr>
    <tr>
        <td colspan="2">邮件测试</td>
    </tr>

    <tr>
        <td>
            <form:form action="${contextPath}/admin/system/config/sendMail" method="post" name="userRegForm" id="userRegForm">
                请输入有效的邮件地址：
                <input type="text" class="text" id="email" name="email" placeholder="邮件地址">
                <button type="submit" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick=""> 邮件测试</button>
            </form:form>
        </td>
    </tr>
    <tr>
        <td>
            <span>${sendMailResult}</span>
        </td>
    </tr>
    <tr>
        <td colspan="2">图片测试</td>
    </tr>
    <tr>
        <td>
            <input type="file" id="file" name="file" onchange="" multiple="multiple">
            <button type="submit" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="uploadFile();">图片测试</button>
        </td>
    </tr>
</table>

<script language="JavaScript" type="text/javascript">
    function uploadFile() {
        $.ajaxFileUpload({
            url: contextPath + '/admin/system/config/sendPic',
            secureuri: false,
            fileElementId: 'file',
            dataType: 'json',
            error: function (data, status, e) {
                alert(data);
            },
            success: function (data, status) {
                alert(data);
            }
        });
    }
    function deleteById(id) {
        if (confirm("  确定删除 ?")) {
            window.location = "${contextPath}/admin/paytype/delete/"
                    + id;
        }
    }
    function pager(curPageNO) {
        document.getElementById("curPageNO").value = curPageNO;
        document.getElementById("form1").submit();
    }
</script>

